{% extends "layout.html" %}

{% block title %}Gestion des clients{% endblock %}

{% block content %}
<script type="text/javascript"> if (window.jQuery == undefined) document.write( unescape('%3Cscript src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"%3E%3C/script%3E') );</script>
<script type="text/javascript" src="js/vendor/jquery.tablesorter.min.js"></script>
<script>
	$(function(){
  $("#myTable").tablesorter();
});
</script>
<!-- Tableau listant les clients -->
<fieldset>
		<legend>Liste des commandes</legend>
		<table class="table table-striped tablesorter" id="myTable" >
		  <thead>
			<tr>
			  <th>Code Client</th>
			  <th>Raison social</th>
			  <th>Statut</th>
			   <th>date de creation</th>
			   <th>date de traitement</th>
			   <th></th>
			</tr>
		  </thead>
		  <tbody>
			{% for commande in commandes %}
			{% if commande.statut == 'en cours' %}
			<tr class="warning">
			{% elseif commande.statut == 'envoyée' %}
			<tr class="info">
			{% elseif commande.statut == 'traitée' %}
			<tr class="success">
			{% endif %}
				<td>{{commande.code_client_hto}}</td>
				<td>{{commande.raison_social}}</td>
				<td>{{commande.statut}}</td>
				<td>{{commande.date_creation}}</td>
				<td>{{commande.date_traitement}}</td>
				<td>
				<div class="btn-group">
					  <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
						Actions
						<span class="caret"></span>
					  </a>
					  <ul class="dropdown-menu">
							<li><a href="creation-commande?id={{commande.id}}"><i class="icon-edit"></i> Voir le détail de la commande</a></li>
                            {% if commande.statut == 'en cours' %}
                            <li><a href="liste-commande?id={{commande.id}}&delete=ok"><i class="icon-edit"></i> Supprimer la commande</a></li>
                            {% endif %}
							
					  </ul>
					</div>
				
				
				
				</td>
				<td>
					
				</td>
			</tr>
			
			{% endfor %}
			
		  </tbody>
		</table>
</fieldset>


{% endblock %}